from x01_stock.xx_util.MyDrissionPage import get_headers_rzrq

url = 'https://data.10jqka.com.cn/market/rzrqgg/code/300251/'
url = 'https://data.10jqka.com.cn/ajax/rzrqgg/code/300251/order/desc/page/2/'
headers1 = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'Host': 'data.10jqka.com.cn',
    'Referer': 'https://www.10jqka.com/',
    'Connection': 'keep-alive',
    'Cookie': 'historystock=300851; spversion=20130314; u_ukey=A10702B8689642C6BE607730E11E6E4A; u_uver=1.0.0; u_dpass=M6jvNigME2UCrpGldoPcPCJrM1dR6KcWBAlo2LjoAjIBHQFeKVBFZjnjmV7n9RIMHi80LrSsTFH9a%2B6rtRvqGg%3D%3D; u_did=82648751961047C788170A07F408C5CA; u_ttype=WEB; user_status=0; Hm_lvt_722143063e4892925903024537075d0d=1721390901,1721446364,1721479429,1721735359; Hm_lvt_929f8b362150b1f77b477230541dbbc2=1721390901,1721446365,1721479429,1721735359; Hm_lvt_60bad21af9c824a4a0530d5dbf4357ca=1721735336,1721905662,1722069481,1722072333; HMACCOUNT=FFE4A3ECF588E087; Hm_lvt_f79b64788a4e377c608617fba4c736e2=1721735336,1721905662,1722069481,1722072333; Hm_lvt_78c58f01938e4d85eaf619eae71b4ed1=1721735336,1721905662,1722069481,1722072333; Hm_lpvt_60bad21af9c824a4a0530d5dbf4357ca=1722078612; Hm_lpvt_78c58f01938e4d85eaf619eae71b4ed1=1722078612; Hm_lpvt_f79b64788a4e377c608617fba4c736e2=1722078612; v=Ax2bQTrgJxgGpsM0mjBiiK2NLPISOlEzW2-1et_iXQCi-TNsp4phXOu-xTJs'

}
headers2= {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'Host': 'data.10jqka.com.cn',
    'Referer': 'https://www.10jqka.com/',
    'Connection': 'keep-alive',
    'Cookie': 'historystock=300851; spversion=20130314; u_ukey=A10702B8689642C6BE607730E11E6E4A; u_uver=1.0.0; u_dpass=M6jvNigME2UCrpGldoPcPCJrM1dR6KcWBAlo2LjoAjIBHQFeKVBFZjnjmV7n9RIMHi80LrSsTFH9a%2B6rtRvqGg%3D%3D; u_did=82648751961047C788170A07F408C5CA; u_ttype=WEB; user_status=0; Hm_lvt_722143063e4892925903024537075d0d=1721390901,1721446364,1721479429,1721735359; Hm_lvt_929f8b362150b1f77b477230541dbbc2=1721390901,1721446365,1721479429,1721735359; Hm_lvt_60bad21af9c824a4a0530d5dbf4357ca=1721735336,1721905662,1722069481,1722072333; HMACCOUNT=FFE4A3ECF588E087; Hm_lvt_f79b64788a4e377c608617fba4c736e2=1721735336,1721905662,1722069481,1722072333; Hm_lvt_78c58f01938e4d85eaf619eae71b4ed1=1721735336,1721905662,1722069481,1722072333; Hm_lpvt_60bad21af9c824a4a0530d5dbf4357ca=1722078612; Hm_lpvt_78c58f01938e4d85eaf619eae71b4ed1=1722078612; Hm_lpvt_f79b64788a4e377c608617fba4c736e2=1722078612; v=Ax2bQTrgJxgGpsM0mjBiiK2NLPISOlEzW2-1et_iXQCi-TNsp4phXOu-xTJs'

}
headers3= {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'Host': 'data.10jqka.com.cn',
    'Referer': 'https://www.10jqka.com/',
    'Connection': 'keep-alive',
    'Cookie': 'historystock=300851; spversion=20130314; u_ukey=A10702B8689642C6BE607730E11E6E4A; u_uver=1.0.0; u_dpass=M6jvNigME2UCrpGldoPcPCJrM1dR6KcWBAlo2LjoAjIBHQFeKVBFZjnjmV7n9RIMHi80LrSsTFH9a%2B6rtRvqGg%3D%3D; u_did=82648751961047C788170A07F408C5CA; u_ttype=WEB; user_status=0; Hm_lvt_722143063e4892925903024537075d0d=1721390901,1721446364,1721479429,1721735359; Hm_lvt_929f8b362150b1f77b477230541dbbc2=1721390901,1721446365,1721479429,1721735359; Hm_lvt_60bad21af9c824a4a0530d5dbf4357ca=1721735336,1721905662,1722069481,1722072333; HMACCOUNT=FFE4A3ECF588E087; Hm_lvt_f79b64788a4e377c608617fba4c736e2=1721735336,1721905662,1722069481,1722072333; Hm_lvt_78c58f01938e4d85eaf619eae71b4ed1=1721735336,1721905662,1722069481,1722072333; Hm_lpvt_60bad21af9c824a4a0530d5dbf4357ca=1722078612; Hm_lpvt_78c58f01938e4d85eaf619eae71b4ed1=1722078612; Hm_lpvt_f79b64788a4e377c608617fba4c736e2=1722078612; v=Ax2bQTrgJxgGpsM0mjBiiK2NLPISOlEzW2-1et_iXQCi-TNsp4phXOu-xTJs'

}
headers_update = [headers1,headers2,headers3]
headers = get_headers_rzrq(headers_update)
for header in headers:
    print(header)
#
# html_prex = '''
#    <!DOCTYPE html>
#    <html>
#    <head lang="en">
#        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
#        <!–[if lte IE 8]>
#        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
#        <![endif]–>
#        <!–[if IE 9]>
#        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7;IE=9"/>
#        <![endif]–>
#        <title>概念资金流向排行-数据中心-同花顺财经</title>
#    </head>
#    <body>
#    '''
# html_tail = '</body></html>'
# response = requests.get(url, headers=headers1)
# response.raise_for_status()
# str = html_prex + response.text + html_tail
# # 将获取到的网页text拼接成html格式存放
# with open('d:\\aa.html', 'w',encoding='utf-8') as file:
#     file.write(str)
#     print()
# print(str)
